﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace Fabrication
{
    internal class DependencyDetails
    {
        private readonly Type owningType;
        private readonly Type propertyType;
        private readonly string targetProperty;
        private readonly IEnumerable<string> dependencies;

        public DependencyDetails(Type owningType, Type propertyType, string targetProperty, IEnumerable<string> dependencies)
        {
            this.owningType = owningType;
            this.propertyType = propertyType;
            this.targetProperty = targetProperty;
            this.dependencies = dependencies;
        }

        public IEnumerable<string> Dependencies
        {
            get { return dependencies; }
        }

        public bool Matches(PropertyInfo property)
        {
            return owningType == property.ReflectedType &&
                   propertyType == property.PropertyType &&
                   targetProperty == property.Name;
        }
    }
}